const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_id_token', {
    id: {
      type: DataTypes.STRING(64),
      allowNull: false,
      primaryKey: true,
      field: 'ID_'
    },
    rev: {
      type: DataTypes.INTEGER,
      allowNull: true,
      field: 'REV_'
    },
    tokenValue: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'TOKEN_VALUE_'
    },
    tokenDate: {
      type: DataTypes.DATE(3),
      allowNull: false,
      defaultValue: "CURRENT_TIMESTAMP(3)",
      field: 'TOKEN_DATE_'
    },
    ipAddress: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'IP_ADDRESS_'
    },
    userAgent: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'USER_AGENT_'
    },
    userId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'USER_ID_'
    },
    tokenData: {
      type: DataTypes.STRING(2000),
      allowNull: true,
      field: 'TOKEN_DATA_'
    }
  }, {
    sequelize,
    tableName: 'act_id_token',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "ID_" },
        ]
      },
    ]
  });
};
